package dao;

import pojo.User;

import java.util.ArrayList;
public class Checkinfoma {
    /**
     * 查找某个具体用户,获得某个具体用户的信息，用于查看个人信息并修改个人信息
     * @param usename
     * @return
     */
    public User check(String usename) {
        ImplementUser implement = new ImplementUser();
        //调用getUsers函数获得封装好了全部用户的集合
        ArrayList<User> listuser = implement.getUsers();
        User userback = new User();
        for (User user : listuser) {
            if (usename.equals(user.getUsename()) ) {//==非等于
                userback.setAge(user.getAge());
                userback.setUsename(user.getUsename());
                userback.setPassword(user.getPassword());
                userback.setGender(user.getGender());
                userback.setTelephone(user.getTelephone());
                break;
            }
        }
        return userback;
    }
}
